const express = require('express')
const router = express.Router()
const AcModel = require('../models/ac')

// GET api/
router.get('/:acId', (req, res, next) => {
  const acId = req.params.acId

  AcModel.getPostById(acId)
    .then((ac) => {
      if (!ac) {
        throw new Error('不存在')
      }
      res.json({ data: ac })
    })
    .catch(next)
})

module.exports = router
